/*
 * pps_bom
 */
package com.pitop.project.api;

import com.pitop.project.entity.Project;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 项目 api请求熔断器
 *
 * @author berton
 */
@FeignClient(value = "pps-cloud-provider", fallback = ProjectFeignApiImpl.class)
public interface ProjectFeignApi {
    /**
     * 查询Project一个详情信息
     *
     * @param id
     * @param code 编码
     * @return Project
     */
    @GetMapping(value = "/project/load")
    Project load(@RequestParam("id") Long id, @RequestParam("code") String code);

    /**
     * 查询Project一个详情信息
     *
     * @param id
     * @param code 编码
     * @return Project
     */
    @GetMapping(value = "/project/get")
    Project get(@RequestParam("id") Long id, @RequestParam("code") String code);

    /**
     * 根据条件id查询Project一个详情信息
     *
     * @param id
     * @return Project
     */
    @GetMapping(value = "/project/load/id/{id}")
    Project loadById(@RequestParam("id") Long id);

    /**
     * 根据条件code查询Project一个详情信息
     *
     * @param code 编码
     * @return Project
     */
    @GetMapping(value = "/project/load/code/{code}")
    Project loadByCode(@RequestParam("code") String code);

    /**
     * 根据条件name查询Project一个详情信息
     *
     * @param name 项目名称
     * @return Project
     */
    @GetMapping(value = "/project/load/name/{name}")
    Project loadByName(@RequestParam("name") String name);

    /**
     * 根据条件projectCode查询Project一个详情信息
     *
     * @param projectCode 项目代码
     * @return Project
     */
    @GetMapping(value = "/project/load/projectCode/{projectCode}")
    Project loadByProjectCode(@RequestParam("projectCode") String projectCode);

    /**
     * 根据条件id查询Project一个详情信息
     *
     * @param id
     * @return Project
     */
    @GetMapping(value = "/project/get/id/{id}")
    Project getById(@RequestParam("id") Long id);

    /**
     * 根据条件code查询Project一个详情信息
     *
     * @param code 编码
     * @return Project
     */
    @GetMapping(value = "/project/get/code/{code}")
    Project getByCode(@RequestParam("code") String code);

    /**
     * 删除Project
     */
    @DeleteMapping("/project/delete")
    void delete(@RequestParam("id") Long id, @RequestParam("code") String code);


    /**
     * 查询Project信息集合
     *
     * @return 分页对象
     */
    @PostMapping(value = "/project/list")
    List<Project> list(@RequestBody Project project, @RequestParam("curPage") int curPage, @RequestParam("pageSize") int pageSize);


    /**
     * 查询Project信息集合
     *
     * @return 分页对象
     */
    @GetMapping(value = "/project/list/by")
    List<Project> listByPk(@RequestParam("id") Long id, @RequestParam("code") String code, @RequestParam("curPage") int curPage, @RequestParam("pageSize") int pageSize);


    /**
     * 统计Project信息数量根据主键
     *
     * @return 总条数
     */
    @GetMapping(value = "/project/count/by")
    Integer count(@RequestParam("id") Long id, @RequestParam("code") String code);

    /**
     * 统计Project信息数量
     *
     * @return 总条数
     */
    @PostMapping(value = "/project/count")
    Integer count(@RequestBody Project project);


    /**
     * 创建Project
     *
     * @return Project
     */
    @PostMapping(value = "/project/build")
    Project build(@RequestBody Project project);


    /**
     * 修改Project
     *
     * @return Project
     */
    @PutMapping(value = "/project/modify")
    Project modify(@RequestBody Project project);


    /**
     * @return Project
     */
    @GetMapping(value = "/project/copy")
    Project copy(@RequestParam("code") String code, @RequestParam("account") String account, @RequestParam("accountCode") String accountCode);

    /**
     * 更改状态
     *  @param code  编码
     * @param state 状态
     */
    @PutMapping("/project/updateState")
    void updateState(@RequestParam("code") String code, @RequestParam("state") String state);
}
